package sbpme.designer.model;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import org.eclipse.draw2d.geometry.Rectangle;

public class Activity extends AbstractModel implements Serializable {

	private static final long serialVersionUID = 8631820381181700569L;
	
	private String name;
	private Rectangle constraint;
	private List<Transition> sourceTransitions;
	private List<Transition> targetTransitions;
	
	public Activity() {
		this.sourceTransitions = new ArrayList<Transition>();
		this.targetTransitions = new ArrayList<Transition>();
	}

	public void addSourceTransition(Transition transition) {
		sourceTransitions.add(transition);
		notifyObservers();
	}

	public void addTargetTransition(Transition transition) {
		targetTransitions.add(transition);		
		notifyObservers();
	}

	public void removeSourceTransition(Transition transition) {
		sourceTransitions.remove(transition);
		notifyObservers();
	}

	public void removeTargetTransition(Transition transition) {
		targetTransitions.remove(transition);		
		notifyObservers();
	}

	public List<Transition> getSourceTransitions() {
		return sourceTransitions;
	}

	public List<Transition> getTargetTransitions() {
		return targetTransitions;
	}

	public void setName(String name) {
		this.name = name;
		notifyObservers();
	}

	public String getName() {
		return name;
	}

	public void setConstraint(Rectangle constraint) {
		this.constraint = constraint;
		notifyObservers();
	}
	
	public Rectangle getConstraint() {
		return constraint;
	}
}
